package cumt.kydd.authoringplatform.controller;

import cumt.kydd.authoringplatform.bean.User;
import cumt.kydd.authoringplatform.service.UserService;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("userInfo")
public class UserInfoUpdateController {
    public static String UserPortrait;
    public static String User_info_email;
    public static String User_info_org;
    public static String User_info_profile;
    public static String User_info_tel;
    public static String User_old_password;
    public static String User_new_password;
    public static String User_check_password;
    @Resource
    private UserService userService;

    /*
    * 更新头像
    */
    @GetMapping("portrait")
    public Map<String, Object> updatePortrait(User user,String portrait){
        UserPortrait = portrait;
//        System.out.println("要更新的头像"+ UserPortrait);
        return userService.updatePortrait();
    }
    @GetMapping("Info")
    public Map<String, Object> updateInfo(String info_username,String info_email,String info_org,String info_profile) {
        User_info_email = info_email;
        User_info_org = info_org;
        User_info_profile = info_profile;
        return userService.updateInfo();
    }

    @GetMapping("tel")
    public Map<String, Object> updateInfo(String info_tel) {
        User_info_tel = info_tel;
        return userService.updateUserTel();
    }

    @GetMapping("pwd")
    public Map<String, Object> updatePassword(String old_password,String new_password,String check_password) {
        User_old_password = old_password;
        User_new_password = new_password;
        User_check_password = check_password;
        return userService.updateUserPassword();
    }
}
